package com.neu.yth.nepBackend.utils;

import java.io.*;

/**
 * @ClassName BufferedFileIo
 * @Description
 * @Author YTH
 * @Date 2024-06-19 14:17
 */
public class BufferedFileIo {
    private  static final String filePath ="C:\\Users\\YTH\\Desktop\\grid.json";

    public static String readStringFromFile() throws IOException {
        StringBuilder content = new StringBuilder();
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            String line;
            while ((line = reader.readLine()) != null) {
                content.append(line).append("\n");
            }
        }
        return content.toString();
    }
    public  static void writeStringToFile( String content) throws IOException {
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))){
            writer.write(content);
        }
    }


}
